After Syria gained its independence in 1946, political life in the country was highly unstable, owing in large measure to intense friction between the country’s social, religious, and political groups. In 1970 Syria came under the authoritarian rule of Pres. Hafiz al-Assad. After Assad’s death in 2000, his son Bashar al-Assad became president. Bashar al-Assad ultimately continued his father’s authoritarian style of governments to quash political dissent. Long-suppressed internal tensions led to the outbreak of the Syrian Civil War in 2011.
library(wbstats)
library(ggplot2)
library(tidyverse)
## ── Attaching packages ────────────────────────────────────────────────────────────────────────────────────── tidyverse 1.3.0 ──
## ✓ tibble 3.0.0 ✓ dplyr 0.8.5
## ✓ tidyr 1.0.2 ✓ stringr 1.4.0
## ✓ readr 1.3.1 ✓ forcats 0.5.0
## ✓ purrr 0.3.3
## Warning: package 'tibble' was built under R version 3.6.2
## ── Conflicts ───────────────────────────────────────────────────────────────────────────────────────── tidyverse_conflicts() ──
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
library(lubridate)
##
## Attaching package: 'lubridate'
## The following object is masked from 'package:base':
##
## date
library(ggthemes)
library(viridis)
## Loading required package: viridisLite
library(plotly)
##
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
##
## last_plot
## The following object is masked from 'package:stats':
##
## filter
## The following object is masked from 'package:graphics':
##
## layout
library(RColorBrewer)
library(leaflet)
library(leaflet.minicharts)
gdp_data_syr <- wbstats::wb(country = "SYR",
indicator = c("NY.GDP.PCAP.KD.ZG") , startdate = 2000, enddate = 2017)
gdp_data_syr$date <- as.numeric(gdp_data_syr$date)
p <- gdp_data_syr %>%
mutate(year = factor(date)) %>%
ggplot(aes(x = year, y = value, group = 1)) +
geom_line(group = 1) + ylab("GDP per capita growth") +xlab(NULL) +
geom_hline(yintercept = 0, color = "red")
ggplotly(p) %>%
plotly::layout(title = list(text = paste0('GDP per capita growth (2000-7)',
'<br>',
'<sup>',
'source: World Bank, Global Poverty Working Group.',
'</sup>')))
# Importing migrant origin and destination numbers for Syria
destination_data <- readxl::read_excel("Data/UN_MigrantStockByOriginAndDestination_2019.xlsx", sheet = 2, skip = 15, col_names = TRUE, trim_ws = TRUE)
# Subsetting origin to Syria
destination_data_syr <- destination_data %>%
dplyr::filter(...3 == "Syrian Arab Republic")
destination_data_syr$Total <- destination_data_syr$Total %>%
as.numeric()
# Subsetting origin to Syria and also 2018. This will be used in the map.
destination_data_syr_2019 <- destination_data_syr %>%
dplyr::filter(...1 == 2019)
# I am not interested in the first 9 columns. Only keeping columns which have data about the destination countries
destination_data_syr_2019 <- destination_data_syr_2019[c(10:241)]
# Making the table vertical- gather
destination_data_syr_2019 <- tidyr::gather(destination_data_syr_2019, key = "country", value = "value")
destination_data_syr_2019$value <- destination_data_syr_2019$value %>%
as.numeric()
destination_data_syr %>%
mutate(year = factor(...1)) %>%
ggplot() +
geom_point(aes(x = year, y = Total)) +
geom_line(aes(x = year, y = Total, group = 1)) +
ylab(NULL) + xlab(NULL) +
geom_segment(aes(x = 3, xend = 3, y = 0, yend = 834916), color = "orange", size = 0.2) +
geom_label(aes(x = 3, y = 200000, label = "2000:\n Bashar Assad\ncomes to power", fill = "yellow"), size = 2.5) +
geom_segment(aes(x = 3.8, xend = 3.8, y = 0, yend = 851000), color = "orange", size = 0.2) +
geom_label(aes(x = 3.8, y = 500000, label = "2004:\n US imposes\nsanctions", fill = "yellow"), size = 2.5) +
geom_segment(aes(x = 5.2, xend = 5.2, y = 0, yend = 1600000), color = "orange", size = 0.2) +
geom_label(aes(x = 5.2, y = 1000000, label = "2011:\n Arab Spring\nSyrian Civil War begins", fill = "yellow"), size = 2.5) +
geom_segment(aes(x = 5.5, xend = 5.5, y = 0, yend = 1300000), color = "orange", size = 0.2) +
geom_label(aes(x=5.5, y=500000, label="2012:\nUN declares state of\ncivil war in Syria", fill = "yellow"),size=2.5) +
geom_segment(aes(x = 6.8, xend = 6.8, y = 0, yend = 867848), color = "orange", size = 0.2) +
geom_label(aes(x=6.8, y=200000, label="2018:\nUS-led missile\nstrikes", fill = "yellow"),size=2.5) +
labs(
title = "Evolution of migration",
subtitle = "1990 - 2019",
caption = "source: World Bank, Global Poverty Working Group."
) +
theme(
legend.position = "none"
) +
scale_color_viridis(discrete=TRUE, guide=FALSE, option="D", direction = 1)
A very large number of migrants from Syria are refugees and asylum seekers who have moved to other countries to search for a safe haven.
This map shows the destinations of the refugees and asylum seekers from Syria in the year 2019.
# world_syr %>%
# group_by(sovereignt) %>%
# summarise(count = n()) %>%
# arrange(desc(count))
#
# world_syr %>%
# filter(sovereignt == "United Kingdom")
#
# world_syr %>%
# filter(sovereignt == "Australia")
#
# world_syr %>%
# filter(sovereignt == "France")
#importing the country centroid data
world <- rgdal::readOGR("Data/country_centroids_az8/country_centroids_az8.shp", verbose = FALSE)
world_sub <- world@data %>%
dplyr::filter(world@data$type != "Dependency")
# Merging data with shape file
world_syr <- merge(world_sub, destination_data_syr_2019, by.x = "sovereignt", by.y = "country", all.x = TRUE)
world_syr_syr <- world_syr %>%
dplyr::filter(sovereignt == "Syria")
group <- c()
lng <- c()
lat <- c()
groupval = 1
for(i in 1:nrow(world_syr)){
# If there is a connection between destination and origin country
if(!is.na(world_syr$value[i])){
# Enter origin country first
group <- c(group, groupval)
lat <- c(lat, world_syr_syr$Latitude)
lng <- c(lng, world_syr_syr$Longitude)
# Enter destination country for same groupvalue
group <- c(group, groupval)
lat <- c(lat, world_syr$Latitude[i])
lng <- c(lng, world_syr$Longitude[i])
# Increment group val
groupval = groupval + 1
}
}
df_syr <- data.frame(group=group, lng=lng, lat=lat)
pal <- colorNumeric("Blues", df_syr$group)
content <- sprintf("<strong>%s</strong><br/>%g",
world_syr$sovereignt,
world_syr$value) %>% lapply(htmltools::HTML)
###### Flow graph
destination_data_syr <- destination_data_syr[c(1, 10:241)]
# Rename column
destination_data_syr <- rename(destination_data_syr, c("year" = "...1"))
flow_data <- destination_data_syr %>%
pivot_longer(-year, names_to = "country", values_to = "count")
world_sub1 <- world_sub %>%
dplyr::select(sovereignt, Latitude, Longitude)
world_sub1 <- rename(world_sub1, c("lat1" = "Latitude", "lng1" = "Longitude"))
flow_data <- merge(flow_data, world_sub1, by.x = "country", by.y = "sovereignt")
flow_data$lat0 = world_syr_syr$Latitude
flow_data$lng0 = world_syr_syr$Longitude
flow_data$count <- as.numeric(flow_data$count)
flow_data <- drop_na(flow_data)
binpal <- colorBin("-RdYlBu", world_syr$value, 6, pretty = FALSE)
leaflet(flow_data) %>%
setView(lat = 35.02547 , lng = 38.50788, zoom = 5) %>%
addTiles(options = providerTileOptions(minZoom = 3, maxZoom = 6)) %>%
addFlows(
flow_data$lng0, flow_data$lat0, flow_data$lng1, flow_data$lat1,
flow = flow_data$count,
time = flow_data$year,
color = "red",
opacity = 0.5,
dir = 1,
popup = popupArgs(labels = "# of Emigrants"),
initialTime = 2019,
minThickness = 0.2,
maxThickness = 10
) %>%
addMinicharts(
lat = flow_data$lat1,
lng = flow_data$lng1,
chartdata = flow_data$count,
time = flow_data$year,
maxValues = NULL,
type = "polar-area",
fillColor = "blue",
colorPalette = ~binpal(flow_data$count),
width = 40,
height = 40,
opacity = 0.7,
showLabels = TRUE,
labelMinSize = 6,
labelMaxSize = 24,
transitionTime = 750,
popup = popupArgs(labels = "# of Emigrants"),
legendPosition = "topright",
initialTime = 2019
)
## Warning in binpal(flow_data$count): Some values were outside the color scale and
## will be treated as NA
# leaflet::leaflet() %>%
# setView(lng = 38.50788, lat = 35.02547, zoom = 2) %>%
# addTiles(options = providerTileOptions(minZoom = 2, maxZoom = 5)) %>%
# addCircles(data = world_syr,
# lat = world_syr$Latitude,
# lng = world_syr$Longitude,
# radius = world_syr$value,
# fillColor = world_syr$value,
# opacity = 0.8, fillOpacity = 0.7,
# popup = content, label = content, labelOptions(
# style = list("font-weight" = "normal", padding = "3px 8px"),
# textsize = "15px",
# direction = "auto")) %>%
# addPolylines(data = df_syr,
# lng = df_syr$lng,
# lat = df_syr$lat,
# group = df_syr$group,
# color = pal(df_syr$group),
# opacity = 0.1,
# weight = 1,
# fillOpacity = df_syr$group,
# fillColor = pal(df_syr$group))
#
The graph below represents the number of deaths that have taken place due to Syrian Civil War since 2011.
# Loading casuality data
cas_syr <- read.csv("Data/VDC_Syria_CASREP.csv", stringsAsFactors = FALSE)
# converting date into year
cas_syr$deathdate <- cas_syr$deathdate %>%
lubridate::as_date() %>%
lubridate::year()
# Aggregating the data, Selecting only civilians
cas_syr1 <- cas_syr %>%
filter(status == "Civilian") %>%
group_by(deathdate) %>%
summarise(count = n())
p <- cas_syr1 %>%
arrange(deathdate) %>%
mutate(year = factor(deathdate)) %>%
ggplot(aes(x=year, y=count, size=count, fill=factor(count))) +
geom_point(alpha=0.5, shape=21, color="black") +
scale_fill_viridis(discrete=TRUE, guide=FALSE, option="A") +
theme(legend.position="none") +
ylab("Deaths") +
xlab(NULL)
ggplotly(p) %>%
plotly::layout(title = list(text = paste0('Civilian deaths due to the war (2011-2019)',
'<br>',
'<sup>',
'source: Casualty Reports from the Violations Documentation Center in Syria.',
'</sup>')))
This table sheds more light on how many of the victims of this war have been children and civilian adults.
cas_syr %>%
dplyr::select(status, gender, deathdate) %>%
dplyr::group_by(deathdate, status, gender) %>%
dplyr::summarise(count = n()) %>%
dplyr::arrange(deathdate, gender) %>%
DT::datatable()
Word-Cloud for Article Coverages: Syria
library(ggplot2)
library(dplyr)
library(stringi)
library(tm)
library(SnowballC)
library(wordcloud)
library(RColorBrewer)
library(corpus)
library(purrr)
library(gower)
library(lme4)
library(multcomp)
library(mvtnorm)
library(corpustools)
text1 <- readLines("Data/syria_v1.txt")
cloud1 <- Corpus(VectorSource(text1))
removeNumPunct <- function(x) {
gsub("[^[:alpha:][:space:]]*", "", x)
}
removeAllCaps <- function(x) {
gsub("\b[A-Z]+\b", "", x)
}
clean_corpus <- function(corpus) {
corpus <- tm_map(corpus, removePunctuation)
corpus <- tm_map(corpus, content_transformer(removeAllCaps))
corpus <- tm_map(corpus, content_transformer(tolower))
#adding too common and not insightful words to the stopwords list
corpus <- tm_map(corpus, removeWords, c("syria","syrian","south","sudan","venezuela","venezuelas","venezuelans","venezuelan","year","years","one","two","three","later","since","month","months","didnt","first","second","third","back","even","now","among","may","get","day","yet","say","country","countries","countrys","president","middle","many","still","says", "bus","left","like","want", "sudanese","sudans","refugee", stopwords("en")))
corpus <- tm_map(corpus, removeNumbers)
corpus <- tm_map(corpus, content_transformer(removeNumPunct))
corpus <- tm_map(corpus, stripWhitespace)
return(corpus)
}
suc_clean1 <- clean_corpus(cloud1)
suc_tdm1 <- TermDocumentMatrix(suc_clean1)
suc_m1 <- as.matrix(suc_tdm1)
suc_v1 <- sort(rowSums(suc_m1), decreasing = TRUE)
suc_d1 <- data.frame(word = names(suc_v1), freq = suc_v1)
set.seed(1234)
wordcloud(
words = suc_d1$word,
freq = suc_d1$freq,scale = c(2, 0.4),
min.freq = 5,
max.words = 100,
random.order = FALSE,
rot.per = 0.3,
colors = brewer.pal(8, "Dark2")
)
Population development in Syria (Medium vs. zero-migration)
dfpop_syria <- dfpop %>%
filter(Variant %in% c("Medium", "Zero migration")) %>%
filter(Location == "Syrian Arab Republic")
plot_popsyria <- ggplot(data=dfpop_syria, aes(x=Time, y=PopTotal, fill=Variant, color=Variant)) + geom_line()
plot_popsyria
This graph illustrates the total population (y-axis) development of the Syrian Arab Republic over time (x-axis). In the period from 1950 to 2019 the population is increasing constantly with the exception from around 2015 to 2019. A possible reason for the development during that period is the Syrian war. From 2020 to 2100 the graph includes two different curves. The red one is the medium projection variant, which the most popular type because it is based on the median of all trajectories based on a probabilistic model. The blue line describes the zero migration variant, which assumes that there is no international migration and projects the population based on that. Interestingly, the population increases at a faster rate when there is migration. That is suprising for a country that experienced a decrease in the total population due to war. However, a possible explanation could be the return of Syrians who fled and registered as refugees in other countries.